package com.dotmedia.entities;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * Entity implementation class for Entity: RolePermission
 * 
 */
@Entity
@Table(name = "role_permissions")
public class RolePermission implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "role_permissions_id_sequence")
	@SequenceGenerator(name = "role_permissions_id_sequence", sequenceName = "role_permissions_id_sequence", allocationSize = 1)
	@Column(name = "role_permission_id")
	private Integer id;

	@ManyToOne
	@JoinColumn(name = "role_id", referencedColumnName = "role_id")
	private Role role;

	@ManyToOne
	@JoinColumn(name = "permission_id", referencedColumnName = "permission_id")
	private Permission permission;

	@ManyToOne
	@JoinColumn(name = "system_id", referencedColumnName = "system_id")
	private SystemEntity system;

	public RolePermission() {
	}

	public RolePermission(Role role, Permission permission, SystemEntity system) {
		this.role = role;
		this.permission = permission;
		this.system = system;
	}

	// Getters and setters
	public SystemEntity getSystem() {
		return system;
	}

	public void setSystem(SystemEntity system) {
		this.system = system;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	public Role getRole() {
		return role;
	}

	public void setPermission(Permission permission) {
		this.permission = permission;
	}

	public Permission getPermission() {
		return permission;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getId() {
		return id;
	}

}
